//
//  HttpOutputResult.m
//  XTCloud
//
//  Created by QA on 2017/3/27.
//  Copyright © 2017年 ShangHai HaoLei Software Technology Co., Ltd. All rights reserved.
//

#import "HttpPlatformOutputResult.h"

@interface HttpPlatformOutputResult()

@property (nonatomic,strong) NSArray *arrayResult;

@end

@implementation HttpPlatformOutputResult

- (instancetype)initWithObjectResult:(id)result
{
    self = [super init];
    if (self) {
        if(result && [result isKindOfClass:[NSArray class]]){
            self.arrayResult = result;
        } else {
            self.arrayResult = [NSArray array];
        }
    }
    return self;
}

- (NSArray*)objectArray
{
    return self.arrayResult;
}

- (NSArray*)objectTableIndex:(NSInteger)index
{
    if(self.arrayResult && index <self.arrayResult.count){
        return [self.arrayResult objectAtIndex:index];
    } else {
        return [NSArray array];
    }
}

- (NSArray*)objectTableFirst
{
    return [self objectTableIndex:0];
}

- (NSDictionary*)objectTableFirstDictionary
{
    NSArray *result = [self objectTableIndex:0];
    if(result.count>0) return result.firstObject;
    else return [NSDictionary dictionary];
}

@end
